// import dt from '@dfeidao/atom-nodejs/dt/parse';
import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	const train_number = get(fd, 'train_number');
	const training_name = fd.data.node.querySelector<HTMLInputElement>('[name="input1"]').value;
	const lecturer_number = get(fd, 'lecturer_number');

	const lecturer_name = get(fd, 'lecturer_name');
	console.log(lecturer_name);
	// const d4 = fd.data.node.querySelector<HTMLInputElement>('[name="input3"]').value;
	// const d5 = fd.data.node.querySelector<HTMLInputElement>('[name="input4"]').value;
	// console.log(dt(d4));
	const training_location = fd.data.node.querySelector<HTMLInputElement>('[name="input5"]').value;
	const training_content = fd.data.node.querySelector<HTMLInputElement>('[name="input6"]').value;


	const res1 = await nodejs<{ code: number }>('train-plan/zj-000004/s004', {
		train_number,
		training_name,
		lecturer_number,
		lecturer_name,
		// train_start_time
		// training_time
		training_location,
		training_content,
		to_state: 200,
		take_effect: 0
	});
	console.log(res1);
	const name_training_material = get(fd, 'titlename');
	const address_training_material = get(fd, 'title');
	console.log(name_training_material);
	console.log(address_training_material);
	const res2 = await nodejs<{ code: number }>('train-plan/zj-000004/s006', {
		train_number,
		name_training_material,
		address_training_material
	});
	console.log(res2);
	if (res1.code === 1 && res2.code === 1) {
		alert('修改成功');
		window.location.reload();
	}
}
